<template>
	<view class="information-list" v-if="list">
		<uni-swipe-action v-if="list.length > 0">
			<uni-swipe-action-item  v-for="(item,index) in list" :key="index">
				<view class="item"  @click="toView(item)">
					<div class="item-l">
						<image mode="aspectFill" src='../../../static/img/monitor/archived.png'></image>
						<text>{{item.healthName}}</text>
					</div>
					<div class="item-c">
						<p v-if="item.type == 1">双向转诊 (转出) 单</p>
						<p v-if="item.type == 2">双向转诊 (回转) 单</p>
						<p>转诊编号：{{!item.status || item.status == 1?'未存档':item.sn}}</p>
						<p>{{!item.status || item.status == 1?'存档时间：未存档':'转诊时间：'+item.referralDate || ''}}</p>
					</div>
					<div :class="['item-r',!item.status || item.status == 1?'not-archived':'archived']">{{!item.status || item.status == '未存档'?'未存档':'已存档'}}</div>
				</view>
			</uni-swipe-action-item>
		</uni-swipe-action>
		<view class="nulldata" style="text-align: center;font-size: 26upx;color: #ccc;padding: 20upx 0;" v-if="nullData && list && list.length > 0">
			<view>没有更多数据了</view>
		</view>
		<view class="noneChating" v-if="list.length <= 0">
			<image src="../../../static/img/index/chattingNone.png"></image>
			<view>暂无数据</view>
		</view>
	</view>
</template>
<script>
	import uSwipeActionItem from "@/components/uni-swipe-action-item/uni-swipe-action-item.vue";
	import uniSwipeAction from "@/components/uni-swipe-action/uni-swipe-action.vue";
	export default{
		data(){
			return {
				pageIndex: 1,
				pageSize: 10,
				list: null,
				page:1,
				nullData: false,
			}
		},
		onLoad(){
			this.getlist({pageIndex:this.pageIndex,pageSize:this.pageSize})
		},
		onReachBottom() {
			if(this.nullData == true){
				return;
			}
			this.page = this.page + 1
			this.getlist({pageIndex:this.page,pageSize:this.pageSize})
		},
		methods:{
			getlist(data){
				this.$api.AppHealthReferralRecordsList(data).then((res)=>{
					var data = res.data.result && res.data.result.elements || [];
					this.list = this.list ? this.list.concat(data) : data;
					if(this.list.length >= res.data.result.totalCount) {
						this.nullData = true
					}
				})
			},
			toView(e) {
				if(e.type == 1) {
					uni.navigateTo({
						url:'/pages/monitor/referral/toView?id='+e.id
					})
				} else {
					uni.navigateTo({
						url:'/pages/monitor/referral/toView1?id='+e.id
					})
				}
				
			},
		}
	}
</script>
<style lang="scss" scoped>
	.noneChating {
		padding-top: 228upx;
		image {
			display: block;
			margin: 0 auto;
			width: 260upx;
			height: 154upx;
		}
		view {
			margin: 24px auto;
			text-align: center;
			color: #333333;
			font-size: 13px;
		}
	}
	@import '@/static/css/monitor/information/informationlist.scss';
</style>
